@extends('home.lrf_layouts')
@section('body')
    <body class="red">
    <div id="login-page" class="row">
        <div class="col s12 z-depth-6 card-panel">
            <form class="login-form">
                <div class="row">
                    <div class="input-field col s12 center">
                        <img src="{{asset('assets/images/avatar.png')}}" alt="头像" width="30%" class="responsive-img valign profile-image-login">
                        <p style="margin-left: 60px;margin-right: 60px;" class="center login-form-text">{{$username}}重置密码
                            <br>请牢记您的新密码</p>
                    </div>
                </div>
                <div class="row margin">
                    <div class="input-field col s12">
                        <i class="mdi-action-lock-outline prefix"></i>
                        <input name="password" id="password" type="password">
                        <label for="password" >新密码</label>
                    </div>
                </div>
                <div class="row margin">
                    <div class="input-field col s12">
                        <i class="mdi-action-lock-outline prefix"></i>
                        <input name="pass" id="pass" type="password">
                        <label for="pass">确认密码</label>
                    </div>
                </div>
                <div class="row">
                    <div class="input-field col s12">
                        <a onclick="chagepass()" class="btn waves-effect waves-light col s12">重置密码</a>
                    </div>
                </div>
            </form>
        </div>
    </div>

    <script>
        function chagepass(){
            var password=$("#password").val();
            var pass=$("#pass").val();
            if(password!=pass){
                layer.msg('两次密码不一样',{icon:5});
                return false;
            }else{
                $.post('{{url('updatepass')}}',{'_token':'{{csrf_token()}}','username':'{{$username}}','password':pass},function(res){
                    if(res.status==0){
                        layer.msg(res.msg);
                    }else{
                        layer.msg(res.msg);
                    }
                });
            }
        }
    </script>
@endsection
